FROM centos:centos7.9.2009 as gitbooke
RUN yum install -y epel-release
RUN yum install -y npm.x86_64 && npm config set registry https://registry.npm.taobao.org
RUN npm install gitbook-cli -g 
ENTRYPOINT ["gitbook", "serve", "--port 80"]
EXPOSE 80
WORKDIR /opt/doc/
RUN npm config set registry=http://registry.npm.taobao.org -g
RUN gitbook install 

FROM gitbooke as doc
WORKDIR /opt/doc/
ADD book.json /opt/doc/
ADD package.json /opt/doc/
RUN npm config set registry=http://registry.npm.taobao.org
RUN gitbook install


FROM doc
WORKDIR /opt/doc/
COPY . /opt/doc/
ENTRYPOINT ["gitbook", "serve"]
EXPOSE 4000
